﻿<%@ page contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理员列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../style/adminStyle.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery.js"></script>
<script src="../js/public.js"></script>

<script type="text/javascript">
var str=${admin.jurisdiction};
function del(id) {
	
	if(str==3){
		if(id!=1){
			
		
		var msg = "您确定要删除吗？\n\n请确认！";
		if (confirm(msg)==true){
			$.ajax({
				"url":"${pageContext.request.contextPath}/Administrators/delete.do",
				"data":"id="+id,
				"type":"POST",
				"dataType":"json",
				"success":function(obj){

					if(obj.state==1){
						alert("已删除");
						location="${pageContext.request.contextPath}/Administrators/admin_list.do";
						
					}
			
				}});
			
		return true;
		}else{
		return false;
		}
		
		}else{
			alert("无法删除");
		}	
	}else{
		alert("权限不足");
	}
	
	}
	function tian() {
		var str=${admin.jurisdiction};
		if(str!=3){
			 alert("权限不足");
				return false;
			
			 
		}
			return true;
	}


</script>
</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i class="user"></i><em>管理员列表</em></span>
    <span class="modular fr" id="rodecen" ><a href="../Administrators/revise_admin.do" class="pt-link-btn" onclick="return tian()">+添加管理员</a></span>
  </div>
  <table class="list-style Interlaced">
   <tr>
    <th>管理员账号/名称</th>
    <th>电子邮箱地址</th>
    <th>加入时间</th>
    <th>手机号码</th>
    <th>权限</th>
    <th>职责</th>
    <th>操作</th>
   </tr>
    <c:forEach items="${adminlist}" var="dataItem">
   <tr>
    <td>${dataItem.rname}</td>
    <td>${dataItem.email}</td>
    <td class="center">${dataItem.registration}</td>
    <td class="center">${dataItem.phone}</td>
    <c:if test="${dataItem.jurisdiction==1}">
		<td align="center">初级管理员</td>
	</c:if>
	
	<c:if test="${dataItem.jurisdiction==2}">
		<td align="center">中级管理员</td>
	</c:if>
	
	<c:if test="${dataItem.jurisdiction==3}">
		<td align="center">高级管理员</td>
	</c:if>
	<td align="center">
	<c:if test="${dataItem.details==1}">
		<span>运营人员</span>
	</c:if>
	
	<c:if test="${dataItem.details==2}">
		<span>合作方</span>
	</c:if>
	<c:if test="${dataItem.details==0}">
		<span>BOSS</span>
	</c:if>
	</td>
    <td class="center" id="center" >
     <a href="../Administrators/del_admin.do?id=${dataItem.id}" title="编辑" onclick="return dele();"><img src="<%=request.getContextPath()%>/images/icon_edit.gif" /></a>
     <a href="#" onclick="javascript:return del(${dataItem.id});" id="shanchu" ><img src="<%=request.getContextPath()%>/images/icon_drop.gif"/></a>
     
    </td>
   </tr>
   </c:forEach>
  </table>
 </div>
<script type="text/javascript">
function dele(){
	var sr=${admin.jurisdiction};
	if(sr!=3){
		 alert("权限不足");
		return false;
	 }else{
		 return true;
	 }
	
	
}

</script>
</body>

</html>